const Router = require('koa-router')
const { ArticleController } = require('../controllers/article.controller')

const articleRoute = new Router({
  prefix: '/article'
})

articleRoute.post('/add', ArticleController.createArticle)
articleRoute.delete('/:id', ArticleController.deleteArticle)
articleRoute.get('/doc/:id', ArticleController.getArticleById)
articleRoute.get('/publish', ArticleController.getPublishedArticle)
articleRoute.get('/unpublish', ArticleController.getUnpublishedArticle)
articleRoute.get('/latest/:id?', ArticleController.getLatestArticle)
articleRoute.get('/history', ArticleController.getHistory)
articleRoute.get('/hot', ArticleController.getHot)
articleRoute.put('/:id/publish', ArticleController.setPublish)
articleRoute.put('/:id', ArticleController.changeArticle)
articleRoute.put('/:id/title', ArticleController.changeTitle)
articleRoute.put('/:id/desc', ArticleController.changeDesc)
articleRoute.put('/:id/content', ArticleController.changeContent)
articleRoute.put('/:id/tags', ArticleController.changeTags)
articleRoute.put('/:id/category', ArticleController.changeCategory)

module.exports = {
  articleRoute
}